using System;
using System.Collections.Generic;
using System.Text;
using Entities;
using Entities;

namespace BLL
{
    public class BGroup
    {
        private static IDAL.IGroup obj = IDAL.DataAccess.CreateGroup();
        public static int Insert(Group group)
        {
            return obj.Insert(group);
        }
        public static int Update(Group group)
        {
            return obj.Update(group);
        }
        public static int Delete(Group group)
        {
            return obj.Delete(group);
        }
        public static Group Load(int groupID)
        {
            return obj.Load(groupID);
        }
        public static IList<Group> GetMyList(int status)
        {
            return obj.GetMyList(status);
        }
        public static IList<User> GetMyUserList(int groupID)
        {
            return obj.GetMyUserList(groupID);
        }

        public static void InsertUsers(int groupID,List<User> users)
        {
            IDAL.IGroupUser gu = IDAL.DataAccess.CreateGroupUser();
            foreach (User item in users)
            {
                GroupUser gue=new GroupUser();
                gue.GroupID=groupID;
                gue.UserID=item.User_id;
                gu.Insert(gue);
            }
        }

        public static void DeleteUsers(int groupID)
        {
            obj.DeleteUsers(groupID);
        }
    }
}
